﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CommonLibrary.Common
{
    public class CommonMethod
    {

        public static String BaseUrl = AppDomain.CurrentDomain.BaseDirectory;

        public static String[] splitString(String str)
        {
            return splitString(str, ';');
        }

        public static String[] splitString(String str, Char charact)
        {
            if (str == null)
                return new String[0];

            String[] IEnuStr;
            if (str.Contains(charact))
            {
                IEnuStr = str.Split(charact);
                List<String> retStr = new List<string>();

                for (var index = 0; index < IEnuStr.Length - 1; index++)
                {
                    retStr.Add(IEnuStr[index]);
                }
                return retStr.ToArray();
            }
            else
            {
                IEnuStr = new String[1];
                IEnuStr[0] = str;
                return IEnuStr;
            }
        }

        /// <summary>
        /// mlh +  2012-04-05
        /// 精确到秒用于获取一个唯一字符编码
        /// </summary>
        /// <returns></returns>
        public static string getUniqueid()
        {
            return DateTime.Now.ToString("yyyyMMddHHmmss");
        }


    }
}
